﻿using System.Runtime.InteropServices;
using RDF;

using stepengine = RDF.ifcengine;

#if _WIN64
using int_t = System.Int64;
#else
using int_t = System.Int32;
#endif

namespace DZJIFC.Model
{
    public class AP242Assembly
    {
        #region Methods

        public AP242Assembly(int_t iInstance, AP242Product relatingProduct, AP242Product relatedProduct)
        {
            Instance = iInstance;
            RelatingProduct = relatingProduct;
            RelatedProduct = relatedProduct;

            stepengine.sdaiGetAttrBN(iInstance, "name", stepengine.sdaiUNICODE, out IntPtr pAttribute);
            Name = Marshal.PtrToStringUni(pAttribute);
        }

        #endregion // Methods

        #region Properties

        public int_t Instance { get; set; }
        public long ExpressID => stepengine.internalGetP21Line(Instance);
        public string? Name { get; private set; }
        public string UniqueName => string.Format("#{0} {1} {2}", ExpressID, Name, IModelStructureView.ITEM_ASSEMBLY);
        public AP242Product RelatingProduct { get; set; }
        public AP242Product RelatedProduct { get; set; }

        #endregion // Properties
    }
}
